// 项目列表数据
var proColumns = [{
  id: 'proName',
  title: '项目名称',
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'role',
  title: '我的角色',
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'level',
  title: '优先级',
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'pmp',
  title: '项目经理',
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'phase',
  title: '当前阶段',
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'status',
  title: '状态',
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'progress',
  title: '项目当前进展',
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'operation',
  title: '操作',
  width: 350,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-info" onclick=""><i class="fa fa-edit"></i>  立项</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-primary" onclick=""><i class="icon-briefcase"></i>  投标</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-success" onclick=""><i class="icon-file-text-alt"></i>  商务报价</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-warning" onclick=""><i class="icon-retweet"></i>  项目进展</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-default" onclick=""><i class="icon-gear (alias)"></i>  管理</button>';
    return content;
  }
} ];
var proOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '项目列表',
  datas: [{
    proName: '项目名称',
    role: '产品经理',
    level: '高',
    pmp: '张三',
    phase: '线索阶段',
    status: '运作中',
    progress: '项目整体进展测试数据'
  }, ],
  columns: proColumns,
  gridContainer: 'proContainer',
  toolbarContainer: 'proToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var proGrid = $.fn.dlshouwen.grid.init(proOption);
$(function () {
  proGrid.load();
});
//客户列表数据
var customerColumns = [{
    id: 'customerName',
    title: '客户名称',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'customerType',
    title: '客户类型',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'industry',
    title: '行业',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'address',
    title: '地址',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'contact',
    title: '联系方式',
    type: 'string',
    width: 110,
    columnClass: 'text-center'
  },
  {
    id: 'personnel',
    title: '负责人',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'operation',
    title: '操作',
    type: 'string',
    columnClass: 'text-center',
    resolution: function (value, record, column, grid, dataNo, columnNo) {
      var content = '';
      content += '<button class="btn btn-xs btn-success" onclick="layer.msg(\'查看' + record.customerName + '的联系人\');"><i class="icon-edit"></i>  更新</button>';
      return content;
    }
  }
];
var customerOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '客户列表',
  datas: [{
      id: 1,
      customerName: '张三',
      customerType: '销售',
      industry: '城市移动网络',
      area: '华北',
      address: '北京市朝阳区XX小区2220室',
      contact: '12345678901',
      personnel: '李四'
    },
    {
      id: 2,
      customerName: '张三',
      customerType: '研发',
      industry: '城市联通网络',
      area: '华北',
      address: '北京市朝阳区XX小区2220室',
      contact: '12345678901',
      personnel: '李四'
    },
    {
      id: 3,
      customerName: '张三',
      customerType: '渠道商',
      industry: '城市电信网络',
      area: '华北',
      address: '北京市朝阳区XX小区2220室',
      contact: '12345678901',
      personnel: '李四'
    },
    {
      id: 4,
      customerName: '张三',
      customerType: '产品经理',
      industry: '智慧城市网络',
      area: '华北',
      address: '北京市朝阳区XX小区2220室',
      contact: '12345678901',
      personnel: '李四'
    },
    {
      id: 5,
      customerName: '张三',
      customerType: 'HR',
      industry: '公共服务网络',
      area: '华北',
      address: '北京市朝阳区XX小区2220室',
      contact: '12345678901',
      personnel: '李四'
    },
    {
      id: 6,
      customerName: '张三',
      customerType: '行政',
      industry: '教育机构',
      area: '华北',
      address: '北京市朝阳区XX小区2220室',
      contact: '12345678901',
      personnel: '李四'
    },
    {
      id: 7,
      customerName: '张三',
      customerType: '人事',
      industry: '城市移动网络',
      area: '华北',
      address: '北京市朝阳区XX小区2220室',
      contact: '12345678901',
      personnel: '李四'
    },
    {
      id: 8,
      customerName: '张三',
      customerType: '分销商',
      industry: '城市移动网络',
      area: '华北',
      address: '北京市朝阳区XX小区2220室',
      contact: '12345678901',
      personnel: '李四'
    },
    {
      id: 9,
      customerName: '张三',
      customerType: '区域总监',
      industry: '城市移动网络',
      area: '华北',
      address: '北京市朝阳区XX小区2220室',
      contact: '12345678901',
      personnel: '李四'
    },
    {
      id: 10,
      customerName: '张三',
      customerType: '主管',
      industry: '城市移动网络',
      area: '华北',
      address: '北京市朝阳区XX小区2220室',
      contact: '12345678901',
      personnel: '李四'
    }
  ],
  columns: customerColumns,
  gridContainer: 'customerContainer',
  toolbarContainer: 'customerToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var customerGrid = $.fn.dlshouwen.grid.init(customerOption);
$(function () {
  customerGrid.load();
});
//联系人列表数据
var telColumns = [{
    id: 'telName',
    title: '联系人名称',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'tell',
    title: '联系方式',
    type: 'string',
    width: 110,
    columnClass: 'text-center'
  },
  {
    id: 'email',
    title: '邮件地址',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'annotation',
    title: '注释',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'operation',
    title: '操作',
    type: 'string',
    columnClass: 'text-center',
    resolution: function (value, record, column, grid, dataNo, columnNo) {
      var content = '';
      content += '<button class="btn btn-xs btn-info" onclick="layer.msg(\'编辑：' + record.telName + '信息\');"><i class="fa fa-edit"></i>  编辑</button>';
      content += '  ';
      content += '<button class="btn btn-xs btn-danger" onclick="layer.msg(\'删除：' + record.telName + '信息\');"><i class="fa fa-trash-o"></i>  删除</button>';
      return content;
    }
  }
];
var telOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '联系人列表',
  datas: [{
    id: 1,
    telName: '张三',
    tell: '12345678901',
    industry: '城市移动网络',
    email: 'zhangsan@certusnet.com',
    annotation: '测试数据'
  }, ],
  columns: telColumns,
  gridContainer: 'telContainer',
  toolbarContainer: 'telToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var telGrid = $.fn.dlshouwen.grid.init(telOption);
$(function () {
  telGrid.load();
});
// 新增联系人
function showtel() {
  $("#telbox").show();
}
// 需求列表
var demandColumns = [{
    id: 'doName',
    title: '当前处理人',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'time',
    title: '提交时间',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'from',
    title: '来源',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'subName',
    title: '提交人',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'proLine',
    title: '产品线',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'priority',
    title: '优先级',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'version',
    title: '基本版本号',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'describe',
    title: '需求描述',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'operation',
    title: '操作',
    type: 'string',
    columnClass: 'text-center',
    resolution: function (value, record, column, grid, dataNo, columnNo) {
      var content = '';
      content += '<button class="btn btn-xs btn-success" onclick="editdemand(' + record.id + ',' + record.demandType + ')"><i class="fa fa-edit"></i>  待办</button>';
      return content;
    }
  }
];
var demandOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '需求列表',
  datas: [{
    id: 1,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '提交需求申请后的处理流程',
    demandType: 1
  }, {
    id: 2,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '退回需求申请后的流程',
    demandType: 2
  }, {
    id: 3,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '需求申请处理答复后的流程',
    demandType: 3
  }, {
    id: 4,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '需求验收未通过的流程',
    demandType: 4
  }, {
    id: 5,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '需求验收退回给需求人员的流程',
    demandType: 5
  }, {
    id: 6,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '需求验收通过的流程',
    demandType: 6
  }, ],
  columns: demandColumns,
  gridContainer: 'demandContainer',
  toolbarContainer: 'demandToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var demandGrid = $.fn.dlshouwen.grid.init(demandOption);
$(function () {
  demandGrid.load();
});
// 处理需求
function editdemand(id, demandType) {
  if (demandType == 1) {
    window.location.href = "../../project/edit/edit-demand-1.html" + '?id=' + id + '&demandType=' + demandType;
  }
  if (demandType == 2) {
    window.location.href = "../../project/edit/edit-demand-2.html" + '?id=' + id + '&demandType=' + demandType;
  }
  if (demandType == 3) {
    window.location.href = "../../project/edit/edit-demand-3.html" + '?id=' + id + '&demandType=' + demandType;
  }
  if (demandType == 4) {
    window.location.href = "../../project/edit/edit-demand-4.html" + '?id=' + id + '&demandType=' + demandType;
  }
  if (demandType == 5) {
    window.location.href = "../../project/edit/edit-demand-5.html" + '?id=' + id + '&demandType=' + demandType;
  }
  if (demandType == 6) {
    window.location.href = "../../project/edit/edit-demand-6.html" + '?id=' + id + '&demandType=' + demandType;
  }
}
// 问题列表
var problemColumns = [{
    id: 'doName',
    title: '当前处理人',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'time',
    title: '提交时间',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'from',
    title: '来源',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'subName',
    title: '提交人',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'proLine',
    title: '产品线',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'priority',
    title: '优先级',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'version',
    title: '基本版本号',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'describe',
    title: '问题描述',
    type: 'string',
    columnClass: 'text-center'
  },
  {
    id: 'operation',
    title: '操作',
    type: 'string',
    columnClass: 'text-center',
    resolution: function (value, record, column, grid, dataNo, columnNo) {
      var content = '';
      content += '<button class="btn btn-xs btn-success" onclick="editproblem(' + record.id + ',' + record.problemType + ')"><i class="fa fa-edit"></i>  待办</button>';
      return content;
    }
  }
];
var problemOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '问题列表',
  datas: [{
    id: 1,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '提交问题申请后的处理流程',
    problemType: 1
  }, {
    id: 2,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '退回问题申请后的流程',
    problemType: 2
  }, {
    id: 3,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '问题申请处理答复后的流程',
    problemType: 3
  }, {
    id: 4,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '问题验收未通过的流程',
    problemType: 4
  }, {
    id: 5,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '问题验收退回给问题人员的流程',
    problemType: 5
  }, {
    id: 6,
    doName: '姓名张三',
    time: '9999-99-99',
    from: '研发部门',
    subName: '姓名李四',
    proLine: 'NFV',
    priority: '高',
    version: 'V1.0.1',
    describe: '问题验收通过的流程',
    problemType: 6
  }, ],
  columns: problemColumns,
  gridContainer: 'problemContainer',
  toolbarContainer: 'problemToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var problemGrid = $.fn.dlshouwen.grid.init(problemOption);
$(function () {
  problemGrid.load();
});
// 处理问题
function editproblem(id, problemType) {
  if (problemType == 1) {
    window.location.href = "../../project/edit/edit-problem-1.html" + '?id=' + id + '&problemType=' + problemType;
  }
  if (problemType == 2) {
    window.location.href = "../../project/edit/edit-problem-2.html" + '?id=' + id + '&problemType=' + problemType;
  }
  if (problemType == 3) {
    window.location.href = "../../project/edit/edit-problem-3.html" + '?id=' + id + '&problemType=' + problemType;
  }
  if (problemType == 4) {
    window.location.href = "../../project/edit/edit-problem-4.html" + '?id=' + id + '&problemType=' + problemType;
  }
  if (problemType == 5) {
    window.location.href = "../../project/edit/edit-problem-5.html" + '?id=' + id + '&problemType=' + problemType;
  }
  if (problemType == 6) {
    window.location.href = "../../project/edit/edit-problem-6.html" + '?id=' + id + '&problemType=' + problemType;
  }
}
// 需求信息处理记录
var editDemandColumns = [{
  id: 'doTime',
  title: '操作时间',
  width: 160,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'dohistory',
  title: '操作记录',
  type: 'string',
  columnClass: 'text-left',
}, ];
var editDemandOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '需求信息处理记录',
  datas: [{
    doTime: '9999-99-99 24:00',
    dohistory: '张三提交需求申请',
  }, ],
  columns: editDemandColumns,
  gridContainer: 'editDemandContainer',
  toolbarContainer: 'editDemandToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var editDemandGrid = $.fn.dlshouwen.grid.init(editDemandOption);
$(function () {
  editDemandGrid.load();
});
//时间控件

// 问题信息处理记录
var editProblemColumns = [{
  id: 'doTime',
  title: '操作时间',
  width: 160,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'dohistory',
  title: '操作记录',
  type: 'string',
  columnClass: 'text-left',
}, ];
var editProblemOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '问题信息处理记录',
  datas: [{
    doTime: '9999-99-99 24:00',
    dohistory: '张三提交问题申请',
  }, ],
  columns: editProblemColumns,
  gridContainer: 'editProblemContainer',
  toolbarContainer: 'editProblemToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var editProblemGrid = $.fn.dlshouwen.grid.init(editProblemOption);
$(function () {
  editProblemGrid.load();
});
//文件下载权限申请
$(".download-icon").on('click', function () {
  //询问框
  layer.confirm('权限不足，是否申请更高权限？', {
    title: '提示信息',
    btn: ['申请', '取消'] //按钮
  }, function () {
    layer.msg('申请成功', {
      icon: 1
    });
  });
});
//文件上传统一字段
function showfile() {
  $(".hidefile").show();
}

function hidefile() {
  $(".hidefile").hide();
}